/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ChatSoft.model.buz;

/**
 *
 * @author KID
 */
import ChatSoft.model.FileTranfer;
import java.io.IOException;
import java.io.RandomAccessFile;

public class FileHandle {
    FileTranfer ft;
    public void ReadFile(FileTranfer ft)
    {
        this.ft = ft;
    }
    public void WriteFile() throws IOException
    {
        RandomAccessFile f = new RandomAccessFile(ft.getFilePath(), "rw");
        try
        {
            f.seek(f.length());
            System.out.println(f.length());
            if(f.length() != 0)
            {
                f.writeBytes(System.getProperty("line.separator"));
            }
            f.writeBytes(ft.getContent());
            
        }
        finally{
            f.close();
        }
    }
    

}
